package com.jeff.android.lab.android.touchevent;

import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;

import com.jeff.android.lab.BaseActivity;
import com.jeff.android.lab.R;
import com.jeff.android.lab.android.touchevent.view.MyFrameLayout;
import com.jeff.android.lab.android.touchevent.view.MyTextView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author: duff
 * @date: 2019/3/20
 * @since: 1.0.0
 */
public class TouchEventActivity extends BaseActivity {
    @BindView(R.id.fl)
    MyFrameLayout fl;
    @BindView(R.id.tv)
    MyTextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.android_fragment_touch_event);
        ButterKnife.bind(this);

//        fl.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//
//                Log.d(TAG, "FrameLayout onTouch ... ");
//
//                return false;
//            }
//        });

//        tv.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Log.d(TAG, "TextView onClick ... ");
//
//                ToastUtil.show(TouchEventActivity.this, "onClick ...");
//            }
//        });

//        tv.setOnLongClickListener(new View.OnLongClickListener() {
//            @Override
//            public boolean onLongClick(View v) {
//
//                ToastUtil.show(TouchEventActivity.this, "onLongClick ...");
//
//                return true;
//            }
//        });

//        tv.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//                Log.d(TAG, "TextView onTouch ... ");
//
//                return false;
//            }
//        });


    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {

        Log.d(TAG, "Activity dispatchTouchEvent ... ");

        return super.dispatchTouchEvent(ev);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {

        Log.d(TAG, "Activity onTouchEvent ... ");


        return super.onTouchEvent(event);
    }

}
